<script setup>
import { useRoute, useRouter } from 'vue-router';

// useRouter,useRoute必须在setup里面使用
// router 整个路由实例，一般用来跳转
// route  当前路由对象，一般获取当前的路径，或者参数等等
const router = useRouter()
const route = useRoute()
//
const go = () => {
  console.log('hi')
  // vue2
  // this.$router.push('/')
  router.push('/?a=123')
}
</script>

<template>
  <h1 @click="go">去首页👍</h1>
  <ul>
    <li>
      <RouterLink to="/">首页</RouterLink>
    </li>
    <li>
      <RouterLink to="/login">登陆</RouterLink>
    </li>
  </ul>

  <RouterView></RouterView>
</template>

